package com.cdz.bus.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.cdz.bus.service.IRequestService;
import com.cdz.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cdz.bus.mapper.BusDockingInfoMapper;
import com.cdz.bus.domain.BusDockingInfo;
import com.cdz.bus.service.IBusDockingInfoService;

/**
 * 对接信息登录Service业务层处理
 *
 * @author guyi
 * @date 2024-11-17
 */
@Service
public class BusDockingInfoServiceImpl extends ServiceImpl<BusDockingInfoMapper, BusDockingInfo> implements IBusDockingInfoService {

    @Autowired
    private BusDockingInfoMapper busDockingInfoMapper;
    @Autowired
    private IRequestService requestService;

    @Override
    public int refreshToken(Long id) throws Exception {
        BusDockingInfo busDockingInfo = busDockingInfoMapper.selectBusDockingInfoById(id);
        requestService.refreshToken(busDockingInfo);
        return 1;
    }


    /**
     * 查询对接信息登录
     *
     * @param id 对接信息登录主键
     * @return 对接信息登录
     */
    @Override
    public BusDockingInfo selectBusDockingInfoById(Long id) {
        return busDockingInfoMapper.selectBusDockingInfoById(id);
    }

    /**
     * 查询对接信息登录列表
     *
     * @param busDockingInfo 对接信息登录
     * @return 对接信息登录
     */
    @Override
    public List<BusDockingInfo> selectBusDockingInfoList(BusDockingInfo busDockingInfo) {
        return busDockingInfoMapper.selectBusDockingInfoList(busDockingInfo);
    }

    /**
     * 新增对接信息登录
     *
     * @param busDockingInfo 对接信息登录
     * @return 结果
     */
    @Override
    public int insertBusDockingInfo(BusDockingInfo busDockingInfo) {
        busDockingInfo.setCreateTime(DateUtils.getNowDate());
        return busDockingInfoMapper.insertBusDockingInfo(busDockingInfo);
    }

    /**
     * 修改对接信息登录
     *
     * @param busDockingInfo 对接信息登录
     * @return 结果
     */
    @Override
    public int updateBusDockingInfo(BusDockingInfo busDockingInfo) {
        busDockingInfo.setUpdateTime(DateUtils.getNowDate());
        return busDockingInfoMapper.updateBusDockingInfo(busDockingInfo);
    }

    /**
     * 批量删除对接信息登录
     *
     * @param ids 需要删除的对接信息登录主键
     * @return 结果
     */
    @Override
    public int deleteBusDockingInfoByIds(Long[] ids) {
        return busDockingInfoMapper.deleteBusDockingInfoByIds(ids);
    }

    /**
     * 删除对接信息登录信息
     *
     * @param id 对接信息登录主键
     * @return 结果
     */
    @Override
    public int deleteBusDockingInfoById(Long id) {
        return busDockingInfoMapper.deleteBusDockingInfoById(id);
    }
}